From 011752ec7b31e3dde376270fc65c7ee70644f6e7 Mon Sep 17 00:00:00 2001
From: Johan Oudinet <johan.oudinet@gmail.com>
Date: Wed, 6 Dec 2017 15:01:17 +0100
Subject: [PATCH] Link with LDLIBS instead of LIBS for DED

Fix ERL-529 by avoiding to link with libz for no reason.

Signed-off-by: Johan Oudinet <johan.oudinet@gmail.com>
---
 lib/asn1/c_src/Makefile             | 2 +-
 lib/runtime_tools/c_src/Makefile.in | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/asn1/c_src/Makefile b/lib/asn1/c_src/Makefile
index 1f714df357..f7c6b8b9bc 100644
--- a/lib/asn1/c_src/Makefile
+++ b/lib/asn1/c_src/Makefile
@@ -126,7 +126,7 @@ $(NIF_LIB_FILE): $(NIF_STATIC_OBJ_FILES)
 	$(V_RANLIB) $@
 
 $(NIF_SHARED_OBJ_FILE): $(NIF_OBJ_FILES)
-	$(V_LD) $(LDFLAGS) -o $(NIF_SHARED_OBJ_FILE) $(NIF_OBJ_FILES) $(CLIB_FLAGS) $(LIBS)
+	$(V_LD) $(LDFLAGS) -o $(NIF_SHARED_OBJ_FILE) $(NIF_OBJ_FILES) $(CLIB_FLAGS) $(LDLIBS)
 
 # ----------------------------------------------------
 # Release Target
diff --git a/lib/runtime_tools/c_src/Makefile.in b/lib/runtime_tools/c_src/Makefile.in
index 4530a83aee..4e13e0d789 100644
--- a/lib/runtime_tools/c_src/Makefile.in
+++ b/lib/runtime_tools/c_src/Makefile.in
@@ -95,7 +95,7 @@ $(OBJDIR)/%$(TYPEMARKER).o: %.c dyntrace_lttng.h
 	$(V_CC) -c -o $@ $(ALL_CFLAGS) $<
 
 $(LIBDIR)/%$(TYPEMARKER).@DED_EXT@: $(OBJDIR)/%$(TYPEMARKER).o
-	$(V_LD) $(LDFLAGS) -o $@ $^ $(LIBS)
+	$(V_LD) $(LDFLAGS) -o $@ $^ $(LDLIBS)
 
 clean:
 	rm -f $(TRACE_LIBS)
-- 
2.14.1

